package com.ytjj.qmyx.admin.service.impl;

import com.github.pagehelper.PageHelper;
import com.ytjj.common.api.CommonPage;
import com.ytjj.qmyx.admin.dao.HotProductCategoryDao;
import com.ytjj.qmyx.admin.model.request.HotProductCategoryRequest;
import com.ytjj.qmyx.admin.model.response.HotProductCategoryResponse;
import com.ytjj.qmyx.admin.service.HotProductCategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 *
 *
 * @Version: 1.0
 */
@Service
public class HotProductCategoryServiceImpl implements HotProductCategoryService {

    @Resource
    private HotProductCategoryDao hotProductCategoryDao;

    @Override
    public CommonPage<HotProductCategoryResponse> selectList(HotProductCategoryRequest hotProductCategoryRequest) {
        PageHelper.startPage(hotProductCategoryRequest.getPageNum(), hotProductCategoryRequest.getPageSize());
        return CommonPage.restPage(hotProductCategoryDao.selectList(hotProductCategoryRequest));
    }

    @Override
    public Integer insertHotProductCategory(Integer hotProductId, String name, Integer sort) {
        return hotProductCategoryDao.insertHotProductCategory(hotProductId, name, sort);
    }

    @Override
    public Integer updateHotProductCategory(String name, Integer categoryId, Integer sort) {
        return hotProductCategoryDao.updateHotProductCategory(name, categoryId, sort);
    }

    @Override
    public Integer removeData(Integer categoryId) {
        return hotProductCategoryDao.removeData(categoryId);
    }
}
